# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-gramfuzz
pkgname=('python2-gramfuzz' 'python-gramfuzz')
_pkgname=gramfuzz
pkgver=1.4.2
pkgrel=6
pkgdesc='A python-based grammar fuzzer.'
arch=('any')
url='https://pypi.org/project/gramfuzz/'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('d580ff9bcdbcf0c2dd979b8c419efc37971d9e0a9fe4ba7a2940c525c2f1d0e1695479750f610a500e8d69c7f01ba0c0f5469d2fb08b13beacd136fafc3990c4')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-gramfuzz() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-gramfuzz() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

